<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      .reds {
        color: red;
      }
    </style>
  </head>

  <body>
    <div id="app">
      <ul>
        <li
          v-for="(m, index) in movies"
          v-on:click="btn(index)"
          :class="{reds: index == currentIndex}"
        >
          {{index}}-{{m}}
        </li>
      </ul>
    </div>

    <script src="../js/vue.js "></script>
    <script>
      const app = new Vue({
        el: '#app',
        data: {
          movies: ['海王', '大话西游', '一人之下'],
          currentIndex: 0
        },
        methods: {
          btn(i) {
            this.currentIndex = i
          }
        }
      })
    </script>
  </body>
</html>
